import request from '@/utils/request'

export const getEmployeesAPI = (params) => {
  return request.get('/sys/user', { params })
}

export const exportExcelAPI = () => {
  return request.get('/sys/user/export', {
    responseType: 'blob'
  })
}

export const downloadExcelTemplateAPI = () => {
  return request.get('/sys/user/import/template', {
    responseType: 'blob'
  })
}

export const uploadExcelTemplateAPI = (formData) => {
  return request.post('/sys/user/import', formData)
}

export const deleteEmployeeAPI = (id) => {
  return request.delete(`/sys/user/${id}`)
}

export const addEmployeeAPI = (data) => {
  return request.post('/sys/user', data)
}

export const getEmployeeDetailAPI = (id) => {
  return request.get(`/sys/user/${id}`)
}
export const updateEmployeeAPI = (data) => {
  return request.put(`/sys/user/${data.id}`, data)
}

export const getEnableRolesAPI = () => {
  return request.get('/sys/role/list/enabled')
}

export const assignRoleAPI = (data) => {
  return request.put('/sys/user/assignRoles', data)
}
